package com.xlk.cxf.client;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.junit.Test;

import com.xlk.cxf.service.IHelloWorldService;

/**
 * 
 * CXF WebService客户端调用代码 </br> 
 * 类名: HelloWorldServiceClient </br> 
 * 日期: 2014-2-18 上午11:38:45 </br> 
 * @author 许立亢 
 * @version 1.0
 */
public class HelloWorldServiceClient {
	public static void main(String[] args) {
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		factory.setServiceClass(IHelloWorldService.class);
		factory.setAddress("http://localhost:9000/helloWorld");
		
		IHelloWorldService service = (IHelloWorldService) factory.create();
		
		System.out.println("結果是  "+service.sayHello("仰望星空"));
	}
	
	@Test
	public void clientTest1(){
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		factory.setServiceClass(IHelloWorldService.class);
		factory.setAddress("http://localhost:8080/CXFWebservice/webservice/helloService");
		
		IHelloWorldService service = (IHelloWorldService) factory.create();
		
		System.out.println("結果是  "+service.sayHello("仰望星空"));
	}
}
